#include "Document.h"
#include "EditorCore/Visitors/EntityDrawer.h"
#include "EditorCore/Traversers/ChildrenFirstEntityTraverser.h"

using namespace drawing;

namespace editor_core {

	Document::Document() {
		m_selector = new Selector();
		m_history = new History();
	}

	Document::~Document() {
		delete m_history;
		delete m_selector;
	}

	void Document::Draw( IDrawer* drawer ) const {
		EntityDrawer* entityDrawer = new EntityDrawer( drawer );
		EntityTraverser* traverser = new ChildrenFirstEntityTraverser();

		traverser->Traverse( GetRootEntity(), entityDrawer );

		delete traverser;
		delete entityDrawer;
	}
}
